package com.diligent.cloud.printer.client.resource;

import com.diligent.cloud.primary.data.model.Result;
import com.diligent.cloud.printer.client.model.TemplateData;
import com.diligent.cloud.printer.client.service.PrinterService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;


/**
 * @Description:
 * @Author: xf107397
 * @Date: Create：in 2020-07-02:11:27
 * @Modified By：
 */
@RestController
public class PrinterResourceImpl implements PrinterResource{
    private final PrinterService printerService;
    public PrinterResourceImpl(PrinterService printerService) {
        this.printerService = printerService;
    }
    @Override
    public ResponseEntity<Result> setTemplateAndData(String dataJson, String dataUrl, String templateUrl
                                                                ,String exportType, String templateXML, MultipartFile templateFile) {
        TemplateData templateData =new TemplateData();
        templateData.setDataJson(dataJson);
        templateData.setDataUrl(dataUrl);
        templateData.setExportType(exportType);
        templateData.setTemplateUrl(templateUrl);
        templateData.setTemplateXML(templateXML);
        templateData.setTemplateFile(templateFile);
        return printerService.setTemplateAndData(templateData);
    }
}
